package com.imooc.utils;

import com.github.pagehelper.PageInfo;

import java.util.List;

/**
 * @author liansen
 * @create 05-27-15:48
 */
public class PageUtils {

    //封装分页
    public static PagedGridResult setterPagedGrid(List<?> list,
                                           Integer page) {
        PageInfo<?> pageList = new PageInfo<>(list);
        PagedGridResult gridResult = new PagedGridResult();
        gridResult.setRows(list);
        gridResult.setPage(page);
        gridResult.setRecords(pageList.getTotal());
        gridResult.setTotal(pageList.getPages());
        return gridResult;
    }

}
